home *** CD-ROM | disk | FTP | other *** search
/ Delphi 2 - Developers' Solutions / Delphi 2 Developers' Solutions.iso / dds / chap03 / howto08 / ufmgr17.pas < prev   
Encoding:
Pascal/Delphi Source File  |  1996-03-06  |  56.1 KB  |  1,610 lines

  1. unit Ufmgr17;
  2.  
  3. interface
  4.  
  5. uses
  6.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  7.   Forms, Dialogs, StdCtrls, Buttons, ExtCtrls, ShellAPI, FileCtrl,
  8.    DRWSUtl1, DRWSUtl3;
  9.  
  10. type
  11.   TCCFileMgrForm = class(TForm)
  12.     Panel1: TPanel;
  13.     Panel2: TPanel;
  14.     BitBtn1: TBitBtn;
  15.     Panel3: TPanel;
  16.     Label1: TLabel;
  17.     BitBtn2: TBitBtn;
  18.     BitBtn3: TBitBtn;
  19.     BitBtn4: TBitBtn;
  20.     BitBtn5: TBitBtn;
  21.     BitBtn6: TBitBtn;
  22.     BitBtn7: TBitBtn;
  23.     OpenDialog1: TOpenDialog;
  24.     BitBtn8: TBitBtn;
  25.     BitBtn9: TBitBtn;
  26.     OpenDialog2: TOpenDialog;
  27.     BitBtn10: TBitBtn;
  28.     Panel4: TPanel;
  29.     Panel5: TPanel;
  30.     Panel6: TPanel;
  31.     Panel7: TPanel;
  32.     Label2: TLabel;
  33.     Label3: TLabel;
  34.     Label4: TLabel;
  35.     procedure FormResize(Sender: TObject);
  36.     procedure FormCreate(Sender: TObject);
  37.     procedure BitBtn7Click(Sender: TObject);
  38.     procedure BitBtn1Click(Sender: TObject);
  39.     procedure BitBtn2Click(Sender: TObject);
  40.     procedure BitBtn3Click(Sender: TObject);
  41.     procedure BitBtn4Click(Sender: TObject);
  42.     procedure BitBtn5Click(Sender: TObject);
  43.     procedure FormPaint(Sender: TObject);
  44.     procedure BitBtn8Click(Sender: TObject);
  45.     procedure BitBtn9Click(Sender: TObject);
  46.     procedure BitBtn6Click(Sender: TObject);
  47.     procedure BitBtn1DragDrop(Sender, Source: TObject; X, Y: Integer);
  48.     procedure BitBtn1DragOver(Sender, Source: TObject; X, Y: Integer;
  49.       State: TDragState; var Accept: Boolean);
  50.     procedure BitBtn2DragDrop(Sender, Source: TObject; X, Y: Integer);
  51.     procedure BitBtn3DragDrop(Sender, Source: TObject; X, Y: Integer);
  52.     procedure BitBtn4DragDrop(Sender, Source: TObject; X, Y: Integer);
  53.     procedure BitBtn10Click(Sender: TObject);
  54.     procedure FormDestroy(Sender: TObject);
  55.     procedure FormKeyDown(Sender: TObject; var Key: Word;
  56.       Shift: TShiftState);
  57.     procedure BitBtn9KeyDown(Sender: TObject; var Key: Word;
  58.       Shift: TShiftState);
  59.     procedure Label2Click(Sender: TObject);
  60.     procedure Label3Click(Sender: TObject);
  61.     procedure Label4Click(Sender: TObject);
  62.     procedure Panel2MouseMove(Sender: TObject; Shift: TShiftState; X,
  63.       Y: Integer);
  64.     procedure Panel1MouseMove(Sender: TObject; Shift: TShiftState; X,
  65.       Y: Integer);
  66.     procedure Panel4MouseMove(Sender: TObject; Shift: TShiftState; X,
  67.       Y: Integer);
  68.     procedure Panel3MouseMove(Sender: TObject; Shift: TShiftState; X,
  69.       Y: Integer);
  70.     procedure BitBtn1MouseMove(Sender: TObject; Shift: TShiftState; X,
  71.       Y: Integer);
  72.     procedure BitBtn2MouseMove(Sender: TObject; Shift: TShiftState; X,
  73.       Y: Integer);
  74.     procedure BitBtn3MouseMove(Sender: TObject; Shift: TShiftState; X,
  75.       Y: Integer);
  76.     procedure BitBtn4MouseMove(Sender: TObject; Shift: TShiftState; X,
  77.       Y: Integer);
  78.     procedure BitBtn5MouseMove(Sender: TObject; Shift: TShiftState; X,
  79.       Y: Integer);
  80.     procedure BitBtn8MouseMove(Sender: TObject; Shift: TShiftState; X,
  81.       Y: Integer);
  82.     procedure BitBtn9MouseMove(Sender: TObject; Shift: TShiftState; X,
  83.       Y: Integer);
  84.     procedure BitBtn6MouseMove(Sender: TObject; Shift: TShiftState; X,
  85.       Y: Integer);
  86.     procedure BitBtn7MouseMove(Sender: TObject; Shift: TShiftState; X,
  87.       Y: Integer);
  88.     procedure BitBtn10MouseMove(Sender: TObject; Shift: TShiftState; X,
  89.       Y: Integer);
  90.     procedure Panel5MouseMove(Sender: TObject; Shift: TShiftState; X,
  91.       Y: Integer);
  92.     procedure Panel6MouseMove(Sender: TObject; Shift: TShiftState; X,
  93.       Y: Integer);
  94.     procedure Panel7MouseMove(Sender: TObject; Shift: TShiftState; X,
  95.       Y: Integer);
  96.     procedure Panel1MouseUp(Sender: TObject; Button: TMouseButton;
  97.       Shift: TShiftState; X, Y: Integer);
  98.     procedure BitBtn1MouseUp(Sender: TObject; Button: TMouseButton;
  99.       Shift: TShiftState; X, Y: Integer);
  100.     procedure BitBtn2MouseUp(Sender: TObject; Button: TMouseButton;
  101.       Shift: TShiftState; X, Y: Integer);
  102.     procedure BitBtn3MouseUp(Sender: TObject; Button: TMouseButton;
  103.       Shift: TShiftState; X, Y: Integer);
  104.     procedure BitBtn4MouseUp(Sender: TObject; Button: TMouseButton;
  105.       Shift: TShiftState; X, Y: Integer);
  106.   private
  107.     { Private declarations }
  108.   public
  109.     { Public declarations }
  110.     DirectoryListBox1 : TDirectoryListBox;
  111.     FileListBox1 : TIconFileListBox;
  112.     ScrollBox1 : TFileIconPanelScrollbox;
  113.   end;
  114. var
  115.   CCFileMgrForm      : TCCFileMgrForm;
  116.   CurrentView        : Integer;  { This holds the current view setting      }
  117.  
  118. implementation
  119.  
  120. {$R *.DFM}
  121.  
  122. uses DDDFUnit,  { Include custom directory selection form }
  123.      CfmpfUn;   { Include custom options dialog           }
  124.  
  125. { Set up the resize to replace the icon buttons }
  126. procedure TCCFileMgrForm.FormResize(Sender: TObject);
  127. begin
  128.   { Send in the panel and global buttons list }
  129.   SpacePanelButtons( Panel2 );
  130. end;
  131.  
  132. { Delphi wrote this; use it to set everything up }
  133. procedure TCCFileMgrForm.FormCreate(Sender: TObject);
  134. var TheIconPanel : TFileIconPanel;
  135.     CurrentPath : String;
  136. begin
  137.   { Create the directory list box }
  138.   SavedForm := Self;
  139.   DirectoryListBox1 := TDirectoryListBox.Create( Panel1 );
  140.   DirectoryListBox1.Parent := Panel1;
  141.   DirectoryListBox1.Visible := true;
  142.   DirectoryListbox1.Top := 17;
  143.   DirectoryListbox1.Left := 0;
  144.   DirectoryListbox1.Height := Panel1.Height - 32;
  145.   DirectoryListbox1.Width := 0;
  146.   { Create the file list box }
  147.   FileListBox1 := TIconFileListBox.Create( Panel1 );
  148.   FileListBox1.Parent := Panel1;
  149.   FileListbox1.Top := 17;
  150.   FileListbox1.Left := 146;
  151.   FileListbox1.Height := Panel1.Height - 32;
  152.   FileListbox1.Width := 0;
  153.   FileListBox1.Visible := true;
  154.   FileListBox1.ShowGlyphs := true;
  155.   FileListBox1.MultiSelect := true;
  156.   FileListBox1.DragMode := dmAutomatic;
  157.   { Set intercomponent interactions }
  158.   DirectoryListBox1.FileList := FileListbox1;
  159.   DirectoryListBox1.DirLabel := Label1;
  160.   { Create the scrollbox }
  161.   ScrollBox1 := TFileIconPanelScrollBox.Create( Panel1 );
  162.   ScrollBox1.Parent := Panel1;
  163.   ScrollBox1.align := alClient;
  164.   ScrollBox1.Left := 0;
  165.   ScrollBox1.Top := 0;
  166.   ScrollBox1.Width := Panel1.Width - 32;
  167.   ScrollBox1.Height := Panel1.Height - 32;
  168.   ScrollBox1.IconsNeedRefreshing := false;
  169.   ScrollBox1.TheStoredHandle := Self.Handle;
  170.   ScrollBox1.TheParentForm := Self;
  171.   { Get the current directory with 0 parameter }
  172.   GetDir( 0 , CurrentPath );
  173.   { Set the display caption }
  174.   Label1.Caption := CurrentPath;
  175.   { Add a trailing \ if not root }
  176.   CurrentPath := ScrollBox1.TheFWB.ForceTrailingBackSlash( CurrentPath );
  177.   { Get the icons display using scrollbox1 }
  178.   ScrollBox1.GetIconsForEntireDirectory( CurrentPath );
  179.   { Set the Icon View as default }
  180.   CurrentView := 1;
  181.   { Start the FIP IOManager }
  182.   if not assigned( TheIOManager ) then
  183.   begin
  184.     TheIOManager := TIOManager.Create( Self );
  185.     TheIOManager.Parent := Self;
  186.     TheIOManager.InitLocks;
  187.   end;
  188.   if not Assigned( TheMouseManager ) then
  189.   begin
  190.     TheMouseManager := TMouseManager.Create( Self );
  191.     TheMouseManager.InitializeNormal;
  192.   end;
  193.   { Load the special cursor to toggle the LOCK keys }
  194.   Screen.Cursors[ CR_KEYSET ] := LoadCursor( hInstance , 'KEYSET' );
  195.   Screen.Cursors[ CR_NULL ] := LoadCursor( hInstance , 'BLANKCUR' );
  196.   Panel5.Cursor := CR_KEYSET;
  197.   Panel6.Cursor := CR_KEYSET;
  198.   Panel7.Cursor := CR_KEYSET;
  199.   Label2.Visible := TheIOManager.IsCapsLockDown;
  200.   Label3.Visible := TheIOManager.IsNumLockDown;
  201.   Label4.Visible := TheIOManager.IsScrollLockDown;
  202. end;
  203.  
  204. { Delphi wrote this; use it to close the application }
  205. procedure TCCFileMgrForm.BitBtn7Click(Sender: TObject);
  206. begin
  207.   Close;
  208. end;
  209.  
  210. { Delphi wrote this use it to perform a copy on all selected files }
  211. procedure TCCFileMgrForm.BitBtn1Click(Sender: TObject);
  212. var ThePosition  : Integer;       { Loop counter   }
  213.     CurrentName ,                 { Holds work name}
  214.     TheOldString : String;        { Holds Dir      }
  215.     finished     : Boolean;       { Loop control   }
  216.     WorkingDir   : String;        { Holds mod wd   }
  217.     TargetDir    : String;        { target of op   }
  218.     TheResult    : Integer;       { Modal res hold }
  219. begin
  220.   { Get current directory and save it for later }
  221.   GetDir( 0 , TheOldString );
  222.   { Check for need to add trailing \ }
  223.   WorkingDir := TheOldString;
  224.   WorkingDir := ScrollBox1.TheFWB.ForceTrailingBackSlash( WorkingDir );
  225.   { Display the Windows-based directory input form }
  226.   TheResult := DestDDForm.ShowModal;
  227.   { If not cancelled do the copy }
  228.   if TheResult = mrOK then
  229.   begin
  230.     { Get the target directory with \ OK }
  231.     TargetDir := DestDDForm.GetTargetDirectory;
  232.     { Show the hourglass to indicate waiting }
  233.     Screen.Cursor := crHourGlass;
  234.     { Setup to get all selections }
  235.     ThePosition := 1;
  236.     finished := false;
  237.     while not finished do
  238.     begin
  239.       { Call generic file getting routine based on current view}
  240.       case CurrentView of
  241.         1 : CurrentName := ScrollBox1.GetNextSelection( WorkingDir ,
  242.              ThePosition );
  243.         2 : CurrentName := FileListBox1.GetNextSelection( WorkingDir ,
  244.              ThePosition );
  245.       end;
  246.       { If returns blank string out of selections so exit }
  247.       if CurrentName = '' then finished := true else
  248.       begin
  249.         { If a directory signal error }
  250.         if (( FileGetAttr( CurrentName ) and faDirectory ) = faDirectory ) then
  251.         begin
  252.           if MessageDlg( 'Copy Directory ' + CurrentName + ' to ' + TargetDir
  253.            +'?', mtConfirmation , mbYesNoCancel , 0 ) = mryes then
  254.           begin
  255.             ScrollBox1.TheFWB.RecursivelyCopyDirectory( CurrentName ,
  256.              TargetDir );
  257.           end;
  258.         end
  259.         else
  260.         begin
  261.           Scrollbox1.TheFWB.CopyTheFile( CurrentName , TargetDir );
  262.         end;
  263.       end;
  264.     end;
  265.     { Reset to normal cursor }
  266.     Screen.Cursor := crDefault;
  267.   end;
  268.   { Reset to the original directory }
  269.   ChDir( TheOldString );
  270. end;
  271.  
  272. { Delphi wrote this, use it to move files which are selected }
  273. procedure TCCFileMgrForm.BitBtn2Click(Sender: TObject);
  274. var ThePosition  : Integer;       { Loop counter   }
  275.     CurrentName ,                 { Holds work name}
  276.     TheOldString : String;        { Holds Dir      }
  277.     finished     : Boolean;       { Loop control   }
  278.     WorkingDir   : String;        { Holds mod wd   }
  279.     TargetDir    : String;        { target of op   }
  280.     TheResult    : Integer;       { Modal res hold }
  281. begin
  282.   { Get current directory and save it for later }
  283.   GetDir( 0 , TheOldString );
  284.   { Check for need to add trailing \ }
  285.   WorkingDir := TheOldString;
  286.   WorkingDir := ScrollBox1.TheFWB.ForceTrailingBackSlash( WorkingDIr );
  287.   { Display the Windows-based directory input form }
  288.   TheResult := DestDDForm.ShowModal;
  289.   { If not cancelled do the copy }
  290.   if TheResult = mrOK then
  291.   begin
  292.     { Get the target directory with \ OK }
  293.     TargetDir := DestDDForm.GetTargetDirectory;
  294.     { Show the hourglass to indicate waiting }
  295.     Screen.Cursor := crHourGlass;
  296.     { Set up to get all current selections }
  297.     ThePosition := 1;
  298.     finished := false;
  299.     while not finished do
  300.     begin
  301.       { Call generic file getting routine based on current view}
  302.       case CurrentView of
  303.         1 : CurrentName := ScrollBox1.GetNextSelection( WorkingDir ,
  304.              ThePosition );
  305.         2 : CurrentName := FileListBox1.GetNextSelection( WorkingDir ,
  306.              ThePosition );
  307.       end;
  308.       { If returns blank string then out of selections }
  309.       if CurrentName = '' then finished := true else
  310.       begin
  311.         { If a directory signal error }
  312.         if (( FileGetAttr( CurrentName ) and faDirectory ) = faDirectory ) then
  313.         begin
  314.           if MessageDlg( 'Move Directory ' + CurrentName + ' to ' + TargetDir +
  315.            '?' , mtConfirmation , mbYesNoCancel , 0 ) = mrYes then
  316.             ScrollBox1.TheFWB.RecursivelyMoveDirectory( CurrentName ,
  317.              TargetDir );
  318.         end
  319.         else
  320.         begin
  321.           Scrollbox1.TheFWB.MoveTheFile( CurrentName , TargetDir );
  322.         end;
  323.       end;
  324.       { Reset to normal cursor }
  325.       Screen.Cursor := crDefault;
  326.     end;
  327.   end;
  328.   { Reset to the original directory }
  329.   ChDir( TheOldString );
  330.   if CurrentView = 1 then { Reset icon display if in view }
  331.    ScrollBox1.Update else FileListBox1.Update; { Otherwise update the FLB }
  332. end;
  333.  
  334. { Delphi wrote this, use it to delete files which are selected }
  335. procedure TCCFileMgrForm.BitBtn3Click(Sender: TObject);
  336. var ThePosition  : Integer;       { Loop counter   }
  337.     CurrentName ,                 { Holds work name}
  338.     TheOldString : String;        { Holds Dir      }
  339.     finished     : Boolean;       { Loop control   }
  340.     WorkingDir   : String;        { Holds mod wd   }
  341. begin
  342.   { Get current directory and save it for later }
  343.   GetDir( 0 , TheOldString );
  344.   { Check for need to add trailing \ }
  345.   WorkingDir := TheOldString;
  346.   WorkingDir := ScrollBox1.TheFWB.ForceTrailingBackSlash( WorkingDIr );
  347.   { Set up to do loop for selected files }
  348.   ThePosition := 1;
  349.   finished := false;
  350.   while not finished do
  351.   begin
  352.     { Call generic file getting routine based on current view}
  353.     case CurrentView of
  354.       1 : CurrentName := ScrollBox1.GetNextSelection( WorkingDir ,
  355.            ThePosition );
  356.       2 : CurrentName := FileListBox1.GetNextSelection( WorkingDir ,
  357.            ThePosition );
  358.     end;
  359.     { if returns blank string out of selections }
  360.     if CurrentName = '' then finished := true else
  361.     begin
  362.       { If its a directory signal error }
  363.       if (( FileGetAttr( CurrentName ) and faDirectory ) = faDirectory ) then
  364.       begin
  365.         if MessageDlg( 'Delete Directory ' + CurrentName + '?' , mtConfirmation,
  366.          mbYesNoCancel , 0 ) = mrYes then
  367.         begin
  368.           ScrollBox1.TheFWB.RecursivelyDeleteDirectory( CurrentName );
  369.           Scrollbox1.TheFWB.RemoveDirectory( Currentname );
  370.         end;
  371.       end
  372.       else
  373.       begin
  374.         { Otherwise get confirmation message and if OKed delete file }
  375.         if MessageDlg( 'Delete file ' + CurrentName + '?', mtConfirmation ,
  376.          mbYesNoCancel , 0 ) = mrYes then
  377.         begin
  378.           ScrollBox1.TheFWB.DeleteTheFile( Currentname );
  379.         end;
  380.       end;
  381.     end;
  382.   end;
  383.   if CurrentView = 1 then { Reset icon display if in view }
  384.    ScrollBox1.Update else FileListBox1.Update; { Otherwise update the FLB }
  385. end;
  386.  
  387. { Delphi wrote this; use it to rename selected files }
  388. procedure TCCFileMgrForm.BitBtn4Click(Sender: TObject);
  389. var ThePosition  : Integer;       { Loop counter   }
  390.     CurrentName ,                 { Holds work name}
  391.     TheOldString : String;        { Holds Dir      }
  392.     finished     : Boolean;       { Loop control   }
  393.     WorkingDir   : String;        { Holds mod wd   }
  394. begin
  395.   { Get current directory for later }
  396.   GetDir( 0 , TheOldString );
  397.   { Check for need to add trailing \ }
  398.   WorkingDir := TheOldString;
  399.   WorkingDir := ScrollBox1.TheFWB.ForceTrailingBackSlash( WorkingDIr );
  400.   { Set up to do loop for selected files }
  401.   ThePosition := 1;
  402.   finished := false;
  403.   while not finished do
  404.   begin
  405.     { Call generic file getting routine based on current view}
  406.     case CurrentView of
  407.       1 : CurrentName := ScrollBox1.GetNextSelection( WorkingDir ,
  408.            ThePosition );
  409.       2 : CurrentName := FileListBox1.GetNextSelection( WorkingDir ,
  410.            ThePosition );
  411.     end;
  412.     { If returns blank string then out of selections }
  413.     if CurrentName = '' then finished := true else
  414.     begin
  415.       { Otherwise set up the opendialog with filename and caption }
  416.       OpenDialog1.Filename := ExtractFilename( CurrentName );
  417.       { Use this to prevent error from changing directories }
  418.       OpenDialog1.Options := [ofNoChangeDir];
  419.       OpenDialog1.Title := 'Rename File';
  420.       { If not cancelled then do rename or signal error }
  421.       if OpenDialog1.Execute then
  422.       begin
  423.         ScrollBox1.TheFWB.RenameTheFile( CurrentName , OpenDialog1.Filename );
  424.       end;
  425.     end;
  426.   end;
  427.   if CurrentView = 1 then { Reset icon display if in view }
  428.    ScrollBox1.Update else FileListBox1.Update; { Otherwise update the FLB }
  429. end;
  430.  
  431. { Delphi wrote this; use it to make a new directory under current one }
  432. procedure TCCFileMgrForm.BitBtn5Click(Sender: TObject);
  433. begin
  434.   { Set up the dialog to get the new directory name }
  435.   OpenDialog2.FileName := '*.*';
  436.   OpenDialog2.Title := 'Enter Directory Name';
  437.   if OpenDialog1.Execute then
  438.   begin
  439.     { If not cancelled make new directory }
  440.     Scrollbox1.TheFWB.CreateNewDirectory( OpenDialog1.Filename );
  441.   end;
  442.   if CurrentView = 1 then { Reset icon display if in view }
  443.    ScrollBox1.Update else FileListBox1.Update; { Otherwise update the FLB }
  444. end;
  445.  
  446. { Delphi wrote this; use it to handle refreshing the scrollbox }
  447. procedure TCCFileMgrForm.FormPaint(Sender: TObject);
  448. var CurrentDirectory : String; { Get current dir }
  449. begin
  450.   { If updated, do refresh }
  451.   if ScrollBox1.IconsNeedRefreshing then
  452.   begin
  453.     Scrollbox1.ClearTheFIPs;
  454.     ScrollBox1.IconsNeedRefreshing := false;
  455.     GetDir( 0 , CurrentDirectory );
  456.     { Force trailing backslash }
  457.     CurrentDirectory := ScrollBox1.TheFWB.ForceTrailingBackSlash(
  458.      CurrentDirectory );
  459.     { Set the label to the new directory }
  460.     Label1.Caption := UpperCase( CurrentDirectory );
  461.     { Do the update }
  462.     ScrollBox1.GetIconsForEntireDirectory( CurrentDirectory );
  463.   end;
  464. end;
  465.  
  466. { Delphi wrote this; use it to reset the current view Icons/List }
  467. procedure TCCFileMgrForm.BitBtn8Click(Sender: TObject);
  468. var TheOldString : String; { Use to get current directory }
  469. begin
  470.   { Reset currentview }
  471.   if CurrentView = 1 then CurrentView := 2 else
  472.    CurrentView := 1;
  473.   { either show the windows boxes or the scrollbox }
  474.   case CurrentView of
  475.     1 : begin
  476.           { Make the listboxes invisible by changing align and width }
  477.           FileListBox1.Visible := false;
  478.           FileListBox1.Align := alNone;
  479.           FileListBox1.Width := 0;
  480.           DirectoryListBox1.Visible := false;
  481.           DirectoryListBox1.align := alNone;
  482.           DirectoryListBox1.Width := 0;
  483.           { Keep them from getting mouse clicks }
  484.           FileListBox1.Enabled := false;
  485.           DirectoryListBox1.Enabled := false;
  486.           { Have the scrollbox get mouse and be seen  by resetting align/wid}
  487.           Scrollbox1.align := alClient;
  488.           Scrollbox1.width := Panel1.Width - 32;
  489.           ScrollBox1.Enabled := true;
  490.           { Tell the scrollbox to repaint itself just in case }
  491.           ScrollBox1.Update;
  492.         end;
  493.     2 : begin
  494.           { Make the listboxes visible by resetting align and width}
  495.           FileListBox1.Visible := true;
  496.           DirectoryListBox1.Visible := true;
  497.           DirectoryListBox1.width := 145;
  498.           DirectoryListBox1.align := alLeft;
  499.           FileListBox1.align := alClient;
  500.           FileListBox1.Width := Panel1.Width - 32 - DirectoryListBox1.Width;
  501.           { Have them getting mouse clicks }
  502.           FileListBox1.Enabled := true;
  503.           DirectoryListBox1.Enabled := true;
  504.           { Have the scrollbox not get mouse and not be seen via align/width}
  505.           ScrollBox1.Enabled := false;
  506.           ScrollBox1.Visible := false;
  507.           ScrollBox1.align := alNone;
  508.           ScrollBox1.Width := 0;
  509.         end;
  510.   end;
  511.   Invalidate;
  512. end;
  513.  
  514. { Delphi wrote this; use it to do a file search display }
  515. procedure TCCFileMgrForm.BitBtn9Click(Sender: TObject);
  516. var CurrentDirectory : String; { Holds current directory }
  517. begin
  518.   { Set up and run the search dialog }
  519.   OpenDialog2.FileName := '*.*';
  520.   { if not cancelled do the search }
  521.   if OpenDialog2.Execute then
  522.   begin
  523.     { Get current directory }
  524.     GetDir( 0 , CurrentDirectory );
  525.     { Force trailing backslash }
  526.     CurrentDirectory :=
  527.      ScrollBox1.TheFWB.ForceTrailingBackSlash( CurrentDirectory );
  528.     { display recursive search results }
  529.     GlobalAbortFlag := false;
  530.     Scrollbox1.DisplayRecursiveSearchResults(
  531.      CurrentDirectory + ExtractFileName( OpenDialog2.Filename ));
  532.     Label1.Caption := 'Search Results for ' + CurrentDirectory +
  533.      ExtractFileName( OpenDialog2.FileName );
  534.   end;
  535. end;
  536.  
  537. { Delphi wrote this; use it to set a file's properties }
  538. procedure TCCFileMgrForm.BitBtn6Click(Sender: TObject);
  539. var ThePosition  : Integer;       { Loop counter   }
  540.     CurrentName ,                 { Holds work name}
  541.     TheOldString : String;        { Holds Dir      }
  542.     finished     : Boolean;       { Loop control   }
  543.     WorkingDir   : String;        { Holds mod wd   }
  544. begin
  545.   { Get current directory for later }
  546.   GetDir( 0 , TheOldString );
  547.   ThePosition := 1;
  548.   { Check for need to add trailing \ }
  549.   Workingdir := TheOldString;
  550.   WorkingDir := ScrollBox1.TheFWB.ForceTrailingBackSlash( WorkingDIr );
  551.   { Call generic file getting routine based on current view}
  552.   case CurrentView of
  553.     1 : CurrentName := ScrollBox1.GetNextSelection( WorkingDir ,
  554.          ThePosition );
  555.     2 : CurrentName := FileListBox1.GetNextSelection( WorkingDir ,
  556.          ThePosition );
  557.   end;
  558.   { If nothing selected then abort (gets ..!) }
  559.   if CurrentName = '' then
  560.   begin
  561.     MessageDlg( 'No File Selected!' , mtError , [mbOK] , 0 );
  562.     exit;
  563.   end
  564.   else
  565.   begin
  566.     { Otherwise set up the properties form and show it }
  567.     CCFMPropsForm.WorkingFileName := CurrentName;
  568.     CCFMPropsForm.ThePosition := ThePosition;
  569.     CCFMPropsForm.BitBtn4.Enabled := true;
  570.     CCFMPropsForm.Initialize;
  571.     CCFMPropsForm.ShowModal;
  572.   end;
  573.   if CurrentView = 1 then { Reset icon display if in view }
  574.    ScrollBox1.Update else FileListBox1.Update; { Otherwise update the FLB }
  575. end;
  576.  
  577. { Delphi wrote this; use it to drag and drop files for copying }
  578. procedure TCCFileMgrForm.BitBtn1DragDrop(Sender, Source: TObject; X,
  579.   Y: Integer);
  580. var CurrentName ,                 { Holds work name}
  581.     WorkingDir ,
  582.     TheOldString : String;        { Holds Dir      }
  583.     TargetDir    : String;        { target of op   }
  584.     TheResult    : Integer;       { Modal res hold }
  585.     Counter_1    : Integer;
  586. begin
  587.   { Make sure source is indeed a FileIconPanel }
  588.   if Source is TIconFileListbox then
  589.   begin
  590.     with Source as TIconFileListBox do
  591.     begin
  592.      { Get current directory and save it for later }
  593.      GetDir( 0 , TheOldString );
  594.      WorkingDir := ScrollBox1.TheFWB.ForceTrailingBackSlash( TheOldString );
  595.      { Display the Windows-based directory input form }
  596.      TheResult := DestDDForm.ShowModal;
  597.      { If not cancelled do the copy }
  598.      if TheResult = mrOK then
  599.      begin
  600.        for Counter_1 := 1 to Items.Count do
  601.        begin
  602.          if Selected[ Counter_1 - 1 ] then
  603.          begin
  604.             CurrentName := WorkingDIr + Items[ Counter_1 - 1 ];
  605.             { Get the target directory with \ OK }
  606.             TargetDir := DestDDForm.GetTargetDirectory;
  607.             { If a directory signal and do recursive operation }
  608.             if (( FileGetAttr( CurrentName ) and faDirectory ) = faDirectory ) then
  609.             begin
  610.               if MessageDlg( 'Copy Directory ' + CurrentName + ' to ' + TargetDir
  611.                +'?', mtConfirmation , mbYesNoCancel , 0 ) = mryes then
  612.               begin
  613.                 ScrollBox1.TheFWB.RecursivelyCopyDirectory( CurrentName ,
  614.                  TargetDir );
  615.               end;
  616.             end
  617.             else
  618.             begin
  619.               { Do the copy }
  620.               Scrollbox1.TheFWB.CopyTheFile( CurrentName , TargetDir );
  621.             end;
  622.             { Reset to the original directory }
  623.             ChDir( TheOldString );
  624.           end;
  625.         end;
  626.       end;
  627.     end;
  628.     FileListBox1.Update;
  629.     exit;
  630.   end;
  631.   if TheIOManager.WasSHIFTPressed then
  632.   begin
  633.     BitBtn1Click( Source );
  634.     exit;
  635.   end;
  636.   with Source as TFileIconPanel do
  637.   begin
  638.     { Get current directory and save it for later }
  639.     GetDir( 0 , TheOldString );
  640.     { Display the Windows-based directory input form }
  641.     TheResult := DestDDForm.ShowModal;
  642.     { If not cancelled do the copy }
  643.     if TheResult = mrOK then
  644.     begin
  645.       CurrentName := FTheName;
  646.       { Get the target directory with \ OK }
  647.       TargetDir := DestDDForm.GetTargetDirectory;
  648.       { If a directory signal and do recursive operation }
  649.       if (( FileGetAttr( CurrentName ) and faDirectory ) = faDirectory ) then
  650.       begin
  651.         if MessageDlg( 'Copy Directory ' + CurrentName + ' to ' + TargetDir
  652.          +'?', mtConfirmation , mbYesNoCancel , 0 ) = mryes then
  653.         begin
  654.           ScrollBox1.TheFWB.RecursivelyCopyDirectory( CurrentName ,
  655.            TargetDir );
  656.         end;
  657.       end
  658.       else
  659.       begin
  660.         { Do the copy }
  661.         Scrollbox1.TheFWB.CopyTheFile( CurrentName , TargetDir );
  662.       end;
  663.       { Reset to the original directory }
  664.       ChDir( TheOldString );
  665.     end;
  666.   end;
  667. end;
  668.  
  669. { Delphi wrote this; use it to generically OK DnD from FIPs }
  670. procedure TCCFileMgrForm.BitBtn1DragOver(Sender, Source: TObject; X,
  671.   Y: Integer; State: TDragState; var Accept: Boolean);
  672. begin
  673.   { Only accept from FileIconPanel components }
  674.   if ( Source is TFileIconPanel ) or
  675.      ( Source is TIconFileListBox ) then Accept := true else Accept := false;
  676. end;
  677.  
  678. { Delphi wrote this; use it to accept Drag and Drop moving }
  679. procedure TCCFileMgrForm.BitBtn2DragDrop(Sender, Source: TObject; X,
  680.   Y: Integer);
  681. var CurrentName ,                 { Holds work name}
  682.     WorkingDir ,
  683.     TheOldString : String;        { Holds Dir      }
  684.     TargetDir    : String;        { target of op   }
  685.     TheResult       : Integer;    { Modal res hold }
  686.     Counter_1   : Integer;
  687. begin
  688.   { Make sure source is indeed a FileIconPanel }
  689.   if Source is TIconFileListbox then
  690.   begin
  691.     with Source as TIconFileListBox do
  692.     begin
  693.       { Get current directory and save it for later }
  694.       GetDir( 0 , TheOldString );
  695.       WorkingDir := ScrollBox1.TheFWB.ForceTrailingBackSlash( TheOldString );
  696.       { Display the Windows-based directory input form }
  697.       TheResult := DestDDForm.ShowModal;
  698.       for Counter_1 := 1 to Items.Count do
  699.       begin
  700.         if Selected[ Counter_1 - 1 ] then
  701.         begin
  702.           { If not cancelled do the copy }
  703.           if TheResult = mrOK then
  704.           begin
  705.             CurrentName := WorkingDir + Items[ Counter_1 - 1 ];
  706.             { Get the target directory with \ OK }
  707.             TargetDir := DestDDForm.GetTargetDirectory;
  708.             { If a directory signal and do recursive operation }
  709.             if (( FileGetAttr( CurrentName ) and faDirectory ) = faDirectory ) then
  710.             begin
  711.               if MessageDlg( 'Move Directory ' + CurrentName + ' to ' + TargetDir
  712.                +'?', mtConfirmation , mbYesNoCancel , 0 ) = mryes then
  713.               begin
  714.                 ScrollBox1.TheFWB.RecursivelyMoveDirectory( CurrentName ,
  715.                  TargetDir );
  716.               end;
  717.             end
  718.             else
  719.             begin
  720.               { Do the copy }
  721.               Scrollbox1.TheFWB.MoveTheFile( CurrentName , TargetDir );
  722.             end;
  723.             { Reset to the original directory }
  724.             ChDir( TheOldString );
  725.           end;
  726.         end;
  727.       end;
  728.     end;
  729.     FileListBox1.Update;
  730.     exit;
  731.   end;
  732.   if TheIOManager.WasSHIFTPressed then
  733.   begin
  734.     BitBtn2Click( Source );
  735.     exit;
  736.   end;
  737.   with Source as TFileIconPanel do
  738.   begin
  739.     { Get current directory and save it for later }
  740.     GetDir( 0 , TheOldString );
  741.     { Display the Windows-based directory input form }
  742.     TheResult := DestDDForm.ShowModal;
  743.     { If not cancelled do the copy }
  744.     if TheResult = mrOK then
  745.     begin
  746.       { Get the target directory with \ OK }
  747.       TargetDir := DestDDForm.GetTargetDirectory;
  748.       { If Copyfile returns false an error occurred }
  749.       CurrentName := FTheName;
  750.       { If a directory signal and do recursion }
  751.       if (( FileGetAttr( CurrentName ) and faDirectory ) = faDirectory ) then
  752.       begin
  753.         if MessageDlg( 'Move Directory ' + CurrentName + ' to ' + TargetDir +
  754.          '?' , mtConfirmation , mbYesNoCancel , 0 ) = mrYes then
  755.           ScrollBox1.TheFWB.RecursivelyMoveDirectory( CurrentName ,
  756.            TargetDir );
  757.       end
  758.       else
  759.       begin  { Do the move }
  760.         Scrollbox1.TheFWB.MoveTheFile( CurrentName , TargetDir );
  761.         ChDir( TheOldString );
  762.       end;
  763.       { Refresh display }
  764.       ScrollBox1.Update;
  765.     end;
  766.   end;
  767. end;
  768.  
  769. { Delphi wrote this; use it to do drag and drop deletes }
  770. procedure TCCFileMgrForm.BitBtn3DragDrop(Sender, Source: TObject; X,
  771.   Y: Integer);
  772. var WorkingDir ,
  773.     CurrentName : String;  { Holds work name}
  774.     Counter_1   : Integer;
  775. begin
  776.   { Make sure source is indeed a FileIconPanel }
  777.   if Source is TIconFileListbox then
  778.   begin
  779.     with Source as TIconFileListBox do
  780.     begin
  781.       GetDir( 0 , WorkingDir );
  782.       WorkingDir := ScrollBox1.TheFWB.ForceTrailingBackSlash( WorkingDir );
  783.       for Counter_1 := 1 to Items.Count do
  784.       begin
  785.         if Selected[ Counter_1 - 1 ] then
  786.         begin
  787.           CurrentName := WorkingDir + Items[ Counter_1 - 1 ];
  788.           { If a directory signal and do recursive operation }
  789.           if (( FileGetAttr( CurrentName ) and faDirectory ) = faDirectory ) then
  790.           begin
  791.             if MessageDlg( 'Delete Directory ' + CurrentName +'?',
  792.              mtConfirmation , mbYesNoCancel , 0 ) = mryes then
  793.             begin
  794.               ScrollBox1.TheFWB.RecursivelyDeleteDirectory( CurrentName );
  795.               Scrollbox1.TheFWB.RemoveDirectory( CurrentName );
  796.             end;
  797.           end
  798.           else
  799.           begin
  800.             if MessageDlg( 'Delete file ' + CurrentName + '?', mtConfirmation ,
  801.              mbYesNoCancel , 0 ) = mrYes then
  802.             begin
  803.               Scrollbox1.TheFWB.DeleteTheFile( CurrentName );
  804.             end;
  805.           end;
  806.         end;
  807.       end;
  808.     end;
  809.     FileListBox1.Update;
  810.     exit;
  811.   end;
  812.   if TheIOManager.WasSHIFTPressed then
  813.   begin
  814.     BitBtn3Click( Source );
  815.     exit;
  816.   end;
  817.   with Source as TFileIconPanel do
  818.   begin
  819.     CurrentName := FTheName;
  820.     { If its a directory signal and do recursive delete }
  821.     if (( FileGetAttr( CurrentName ) and faDirectory ) = faDirectory ) then
  822.     begin
  823.       if MessageDlg( 'Delete Directory ' + CurrentName + '?' , mtConfirmation ,
  824.        mbYesNoCancel , 0 ) = mrYes then
  825.       begin
  826.         Scrollbox1.TheFWB.RecursivelyDeleteDirectory( CurrentName );
  827.         Scrollbox1.TheFWB.RemoveDirectory( CurrentName );
  828.       end;
  829.     end
  830.     else
  831.     begin
  832.       { Otherwise get confirmation message and if OKed delete file }
  833.       if MessageDlg( 'Delete file ' + CurrentName + '?', mtConfirmation ,
  834.        mbYesNoCancel , 0 ) = mrYes then
  835.       begin
  836.         Scrollbox1.TheFWB.DeleteTheFile( CurrentName );
  837.       end;
  838.     end;
  839.     { Refresh Display }
  840.     Scrollbox1.Update;
  841.   end;
  842. end;
  843.  
  844. { Delphi wrote this; use it to do drag and drop renames }
  845. procedure TCCFileMgrForm.BitBtn4DragDrop(Sender, Source: TObject; X,
  846.   Y: Integer);
  847. var WorkingDir ,
  848.     CurrentName : String;  { Holds work name}
  849.     Counter_1   : Integer;
  850. begin
  851.   { Make sure source is indeed a FileIconPanel }
  852.   if Source is TIconFileListbox then
  853.   begin
  854.     with Source as TIconFileListBox do
  855.     begin
  856.       GetDir( 0 , WorkingDir );
  857.       WorkingDir := ScrollBox1.TheFWB.ForceTrailingBackSlash( WorkingDir );
  858.       for Counter_1 := 1 to Items.Count do
  859.       begin
  860.         if Selected[ Counter_1 - 1 ] then
  861.         begin
  862.           CurrentName := WorkingDir + Items[ Counter_1 - 1 ];
  863.           { Otherwise set up the opendialog with filename and caption }
  864.           OpenDialog2.Filename := ExtractFilename( CurrentName );
  865.           { Use this to prevent error from changing directories }
  866.           OpenDialog2.Options := [ofNoChangeDir];
  867.           OpenDialog2.Title := 'Rename File';
  868.           { If not cancelled then do rename or signal error }
  869.           if OpenDialog2.Execute then
  870.           begin
  871.             Scrollbox1.TheFWB.RenameTheFile( CurrentName , OpenDialog2.Filename );
  872.           end;
  873.         end;
  874.       end;
  875.     end;
  876.     FileListBox1.Update;
  877.     exit;
  878.   end;
  879.   if TheIOManager.WasSHIFTPressed then
  880.   begin
  881.     BitBtn4Click( Source );
  882.     exit;
  883.   end;
  884.   with Source as TFileIconPanel do
  885.   begin
  886.     CurrentName := FTheName;
  887.     { If a directory signal error }
  888.     { Otherwise set up the opendialog with filename and caption }
  889.     OpenDialog2.Filename := ExtractFilename( CurrentName );
  890.     { Use this to prevent error from changing directories }
  891.     OpenDialog2.Options := [ofNoChangeDir];
  892.     OpenDialog2.Title := 'Rename File';
  893.     { If not cancelled then do rename or signal error }
  894.     if OpenDialog2.Execute then
  895.     begin
  896.       Scrollbox1.TheFWB.RenameTheFile( CurrentName , OpenDialog1.Filename );
  897.     end;
  898.     { Refresh the display }
  899.     ScrollBox1.Update;
  900.   end;
  901. end;
  902.  
  903. procedure TCCFileMgrForm.BitBtn10Click(Sender: TObject);
  904. var TheCCFMForm : TCCFileMgrForm;
  905. begin
  906.   TheCCFMForm := TCCFileMgrForm.Create( Application );
  907.   TheCCFMForm.Show;
  908. end;
  909.  
  910. procedure TCCFileMgrForm.FormDestroy(Sender: TObject);
  911. begin
  912.   { Release the IO Manager }
  913.   if assigned( TheIOManager) then
  914.   begin
  915.     TheIOManager.Free;
  916.     TheIOManager := nil;
  917.   end;
  918.   if Assigned( TheMouseManager ) then
  919.   begin
  920.     TheMouseManager.Free;
  921.     TheMouseManager := nil;
  922.   end;
  923. end;
  924.  
  925. procedure TCCFileMgrForm.FormKeyDown(Sender: TObject; var Key: Word;
  926.   Shift: TShiftState);
  927. var S_lock , N_Lock , C_lock : Boolean;
  928. begin
  929.   case Key of
  930.     VK_Capital : begin
  931.                    TheIOManager.ReadLocks( C_lock , N_Lock , S_Lock );
  932.                    C_Lock := not C_Lock;
  933.                    TheIOManager.SetLocks( C_Lock , N_Lock , S_Lock );
  934.                    Label2.Visible := C_Lock;
  935.                  end;
  936.     VK_End : begin
  937.                 ScrollBox1.VertScrollbar.Position :=
  938.                  ScrollBox1.VertScrollbar.Range;
  939.                 ScrollBox1.HorzScrollbar.Position :=
  940.                  ScrollBox1.HorzScrollBar.Range;
  941.              end;
  942.     VK_Home : begin
  943.                 ScrollBox1.VertScrollbar.Position := 0;
  944.                 ScrollBox1.HorzScrollbar.Position := 0;
  945.               end;
  946.     VK_Left : begin
  947.                 TheMouseManager.InitializeNormal;
  948.                 TheIOManager.WhichState := Shift;
  949.                 if TheIOManager.WasSHIFTPressed then
  950.                  TheMouseManager.MoveSmallJumpLeft else
  951.                   if TheIOManager.WasCTRLPressed then
  952.                    TheMouseManager.MoveLargeJumpLeft else
  953.                     TheMouseManager.MoveSinglePixelLeft;
  954.               end;
  955.     VK_Up : begin
  956.                 TheMouseManager.InitializeNormal;
  957.                 TheIOManager.WhichState := Shift;
  958.                 if TheIOManager.WasSHIFTPressed then
  959.                  TheMouseManager.MoveSmallJumpUP else
  960.                   if TheIOManager.WasCTRLPressed then
  961.                    TheMouseManager.MoveLargeJumpUp else
  962.                     TheMouseManager.MoveSinglePixelUp;
  963.               end;
  964.     VK_Right : begin
  965.                 TheMouseManager.InitializeNormal;
  966.                 TheIOManager.WhichState := Shift;
  967.                 if TheIOManager.WasSHIFTPressed then
  968.                  TheMouseManager.MoveSmallJumpRight else
  969.                   if TheIOManager.WasCTRLPressed then
  970.                    TheMouseManager.MoveLargeJumpRight else
  971.                     TheMouseManager.MoveSinglePixelRight;
  972.               end;
  973.     VK_Down : begin
  974.                 TheMouseManager.InitializeNormal;
  975.                 TheIOManager.WhichState := Shift;
  976.                 if TheIOManager.WasSHIFTPressed then
  977.                  TheMouseManager.MoveSmallJumpDown else
  978.                   if TheIOManager.WasCTRLPressed then
  979.                    TheMouseManager.MoveLargeJumpDown else
  980.                     TheMouseManager.MoveSinglePixelDown;
  981.               end;
  982.     VK_F1 : TheIOManager.OnF1Pressed( Sender , Key , Shift );
  983.     VK_F2 : TheIOManager.OnF2Pressed( Sender , Key , Shift );
  984.     VK_F3 : TheIOManager.OnF3Pressed( Sender , Key , Shift );
  985.     VK_F4 : TheIOManager.OnF4Pressed( Sender , Key , Shift );
  986.     VK_F5 : TheIOManager.OnF5Pressed( Sender , Key , Shift );
  987.     VK_F6 : TheIOManager.OnF6Pressed( Sender , Key , Shift );
  988.     VK_F7 : TheIOManager.OnF7Pressed( Sender , Key , Shift );
  989.     VK_F8 : TheIOManager.OnF8Pressed( Sender , Key , Shift );
  990.     VK_F9 : TheIOManager.OnF9Pressed( Sender , Key , Shift );
  991.     VK_F10 : TheIOManager.OnF10Pressed( Sender , Key , Shift );
  992.     VK_F11 : TheIOManager.OnF11Pressed( Sender , Key , Shift );
  993.     VK_F12 : TheIOManager.OnF12Pressed( Sender , Key , Shift );
  994.     VK_Numlock : Begin
  995.                    TheIOManager.ReadLocks( C_lock , N_Lock , S_Lock );
  996.                    N_Lock := not N_Lock;
  997.                    TheIOManager.SetLocks( C_Lock , N_Lock , S_Lock );
  998.                    Label3.Visible := N_Lock;
  999.                  end;
  1000.     VK_Scroll : Begin
  1001.                    TheIOManager.ReadLocks( C_lock , N_Lock , S_Lock );
  1002.                    S_Lock := not S_Lock;
  1003.                    TheIOManager.SetLocks( C_Lock , N_Lock , S_Lock );
  1004.                    Label4.Visible := S_Lock;
  1005.                 end;
  1006.   end;
  1007. end;
  1008.  
  1009. procedure TCCFileMgrForm.BitBtn9KeyDown(Sender: TObject; var Key: Word;
  1010.   Shift: TShiftState);
  1011. begin
  1012.   case Key of
  1013.     VK_CANCEL : begin
  1014.                   if MessageDlg( 'Control Break Pressed! Abort Search?',
  1015.                    mtConfirmation,mbYesNoCancel,0) = mrYes
  1016.                     then GlobalAbortFlag := true;
  1017.                 end;
  1018.   end;
  1019. end;
  1020.  
  1021. procedure TCCFileMgrForm.Label2Click(Sender: TObject);
  1022. var C_Lock , N_Lock , S_Lock : Boolean;
  1023. begin
  1024.   TheIOManager.ReadLocks( C_lock , N_Lock , S_Lock );
  1025.   C_Lock := not C_Lock;
  1026.   TheIOManager.SetLocks( C_Lock , N_Lock , S_Lock );
  1027.   Label2.Visible := C_Lock;
  1028. end;
  1029.  
  1030. procedure TCCFileMgrForm.Label3Click(Sender: TObject);
  1031. var C_Lock , N_Lock , S_Lock : Boolean;
  1032. begin
  1033.   TheIOManager.ReadLocks( C_lock , N_Lock , S_Lock );
  1034.   N_Lock := not N_Lock;
  1035.   TheIOManager.SetLocks( C_Lock , N_Lock , S_Lock );
  1036.   Label3.Visible := N_Lock;
  1037. end;
  1038.  
  1039. procedure TCCFileMgrForm.Label4Click(Sender: TObject);
  1040. var C_Lock , N_Lock , S_Lock : Boolean;
  1041. begin
  1042.   TheIOManager.ReadLocks( C_lock , N_Lock , S_Lock );
  1043.   S_Lock := not S_Lock;
  1044.   TheIOManager.SetLocks( C_Lock , N_Lock , S_Lock );
  1045.   Label4.Visible := S_Lock;
  1046. end;
  1047.  
  1048. procedure TCCFileMgrForm.Panel2MouseMove(Sender: TObject;
  1049.   Shift: TShiftState; X, Y: Integer);
  1050. var ThePoint, TheOtherPoint : TPoint;
  1051. begin
  1052.   if IconDragging then
  1053.   begin
  1054.     ThePoint.X := X + Panel2.Left;
  1055.     ThePoint.Y := Y + Panel2.Top;
  1056.     TheOtherPoint := ClientToScreen( ThePoint );
  1057.     TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1058.     exit;
  1059.   end;
  1060.   if BitmapDragging then
  1061.   begin
  1062.     ThePoint.X := X + Panel2.Left;
  1063.     ThePoint.Y := Y + Panel2.Top;
  1064.     TheOtherPoint := ClientToScreen( ThePoint );
  1065.     TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1066.     exit;
  1067.   end;
  1068. end;
  1069.  
  1070. procedure TCCFileMgrForm.Panel1MouseMove(Sender: TObject;
  1071.   Shift: TShiftState; X, Y: Integer);
  1072. var ThePoint, TheOtherPoint : TPoint;
  1073. begin
  1074.   if IconDragging then
  1075.   begin
  1076.     ThePoint.X := X + Panel1.Left;
  1077.     ThePoint.Y := Y + Panel1.Top;
  1078.     TheOtherPoint := ClientToScreen( ThePoint );
  1079.     TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1080.     exit;
  1081.   end;
  1082.   if BitmapDragging then
  1083.   begin
  1084.     ThePoint.X := X + Panel1.Left;
  1085.     ThePoint.Y := Y + Panel1.Top;
  1086.     TheOtherPoint := ClientToScreen( ThePoint );
  1087.     TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1088.     exit;
  1089.   end;
  1090. end;
  1091.  
  1092. procedure TCCFileMgrForm.Panel4MouseMove(Sender: TObject;
  1093.   Shift: TShiftState; X, Y: Integer);
  1094. var ThePoint, TheOtherPoint : TPoint;
  1095. begin
  1096.   if IconDragging then
  1097.   begin
  1098.     ThePoint.X := X + Panel4.Left;
  1099.     ThePoint.Y := Y + Panel4.Top;
  1100.     TheOtherPoint := ClientToScreen( ThePoint );
  1101.     TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1102.     exit;
  1103.   end;
  1104.   if BitmapDragging then
  1105.   begin
  1106.     ThePoint.X := X + Panel4.Left;
  1107.     ThePoint.Y := Y + Panel4.Top;
  1108.     TheOtherPoint := ClientToScreen( ThePoint );
  1109.     TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1110.     exit;
  1111.   end;
  1112. end;
  1113.  
  1114. procedure TCCFileMgrForm.Panel3MouseMove(Sender: TObject;
  1115.   Shift: TShiftState; X, Y: Integer);
  1116. var ThePoint, TheOtherPoint : TPoint;
  1117. begin
  1118.   if IconDragging then
  1119.   begin
  1120.     ThePoint.X := X + Panel3.Left;
  1121.     ThePoint.Y := Y + Panel3.Top;
  1122.     TheOtherPoint := ClientToScreen( ThePoint );
  1123.     TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1124.     exit;
  1125.   end;
  1126.   if BitmapDragging then
  1127.   begin
  1128.     ThePoint.X := X + Panel3.Left;
  1129.     ThePoint.Y := Y + Panel3.Top;
  1130.     TheOtherPoint := ClientToScreen( ThePoint );
  1131.     TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1132.     exit;
  1133.   end;
  1134. end;
  1135.  
  1136. procedure TCCFileMgrForm.BitBtn1MouseMove(Sender: TObject;
  1137.   Shift: TShiftState; X, Y: Integer);
  1138. var ThePoint, TheOtherPoint : TPoint;
  1139. begin
  1140.   if IconDragging then
  1141.   begin
  1142.     ThePoint.X := X + Panel2.Left + BitBtn1.Left;
  1143.     ThePoint.Y := Y + Panel2.Top + BitBtn1.Top;
  1144.     TheOtherPoint := ClientToScreen( ThePoint );
  1145.     TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1146.     exit;
  1147.   end;
  1148.   if BitmapDragging then
  1149.   begin
  1150.     ThePoint.X := X + Panel2.Left + BitBtn1.Left;
  1151.     ThePoint.Y := Y + Panel2.Top + BitBtn1.Top;
  1152.     TheOtherPoint := ClientToScreen( ThePoint );
  1153.     TheMouseManager.MovebitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1154.     exit;
  1155.   end;
  1156. end;
  1157.  
  1158. procedure TCCFileMgrForm.BitBtn2MouseMove(Sender: TObject;
  1159.   Shift: TShiftState; X, Y: Integer);
  1160. var ThePoint, TheOtherPoint : TPoint;
  1161. begin
  1162.   if IconDragging then
  1163.   begin
  1164.     ThePoint.X := X + Panel2.Left + BitBtn2.Left;
  1165.     ThePoint.Y := Y + Panel2.Top + BitBtn2.Top;
  1166.     TheOtherPoint := ClientToScreen( ThePoint );
  1167.     TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1168.     exit;
  1169.   end;
  1170.   if BitmapDragging then
  1171.   begin
  1172.     ThePoint.X := X + Panel2.Left + BitBtn2.Left;
  1173.     ThePoint.Y := Y + Panel2.Top + BitBtn2.Top;
  1174.     TheOtherPoint := ClientToScreen( ThePoint );
  1175.     TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1176.     exit;
  1177.   end;
  1178. end;
  1179.  
  1180. procedure TCCFileMgrForm.BitBtn3MouseMove(Sender: TObject;
  1181.   Shift: TShiftState; X, Y: Integer);
  1182. var ThePoint, TheOtherPoint : TPoint;
  1183. begin
  1184.   if IconDragging then
  1185.   begin
  1186.     ThePoint.X := X + Panel2.Left + BitBtn3.Left;
  1187.     ThePoint.Y := Y + Panel2.Top + BitBtn3.Top;
  1188.     TheOtherPoint := ClientToScreen( ThePoint );
  1189.     TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1190.     exit;
  1191.   end;
  1192.   if BitmapDragging then
  1193.   begin
  1194.     ThePoint.X := X + Panel2.Left + BitBtn3.Left;
  1195.     ThePoint.Y := Y + Panel2.Top + BitBtn3.Top;
  1196.     TheOtherPoint := ClientToScreen( ThePoint );
  1197.     TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1198.     exit;
  1199.   end;
  1200. end;
  1201.  
  1202. procedure TCCFileMgrForm.BitBtn4MouseMove(Sender: TObject;
  1203.   Shift: TShiftState; X, Y: Integer);
  1204. var ThePoint, TheOtherPoint : TPoint;
  1205. begin
  1206.   if IconDragging then
  1207.   begin
  1208.     ThePoint.X := X + Panel2.Left + BitBtn4.Left;
  1209.     ThePoint.Y := Y + Panel2.Top + BitBtn4.Top;
  1210.     TheOtherPoint := ClientToScreen( ThePoint );
  1211.     TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1212.     exit;
  1213.   end;
  1214.   if BitmapDragging then
  1215.   begin
  1216.     ThePoint.X := X + Panel2.Left + BitBtn4.Left;
  1217.     ThePoint.Y := Y + Panel2.Top + BitBtn4.Top;
  1218.     TheOtherPoint := ClientToScreen( ThePoint );
  1219.     TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1220.     exit;
  1221.   end;
  1222. end;
  1223.  
  1224. procedure TCCFileMgrForm.BitBtn5MouseMove(Sender: TObject;
  1225.   Shift: TShiftState; X, Y: Integer);
  1226. var ThePoint, TheOtherPoint : TPoint;
  1227. begin
  1228.   if IconDragging then
  1229.   begin
  1230.     ThePoint.X := X + Panel2.Left + BitBtn5.Left;
  1231.     ThePoint.Y := Y + Panel2.Top + BitBtn5.Top;
  1232.     TheOtherPoint := ClientToScreen( ThePoint );
  1233.     TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1234.     exit;
  1235.   end;
  1236.   if BitmapDragging then
  1237.   begin
  1238.     ThePoint.X := X + Panel2.Left + BitBtn5.Left;
  1239.     ThePoint.Y := Y + Panel2.Top + BitBtn5.Top;
  1240.     TheOtherPoint := ClientToScreen( ThePoint );
  1241.     TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1242.     exit;
  1243.   end;
  1244. end;
  1245.  
  1246. procedure TCCFileMgrForm.BitBtn8MouseMove(Sender: TObject;
  1247.   Shift: TShiftState; X, Y: Integer);
  1248. var ThePoint, TheOtherPoint : TPoint;
  1249. begin
  1250.   if IconDragging then
  1251.   begin
  1252.     ThePoint.X := X + Panel2.Left + BitBtn8.Left;
  1253.     ThePoint.Y := Y + Panel2.Top + BitBtn8.Top;
  1254.     TheOtherPoint := ClientToScreen( ThePoint );
  1255.     TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1256.     exit;
  1257.   end;
  1258.   if BitmapDragging then
  1259.   begin
  1260.     ThePoint.X := X + Panel2.Left + BitBtn8.Left;
  1261.     ThePoint.Y := Y + Panel2.Top + BitBtn8.Top;
  1262.     TheOtherPoint := ClientToScreen( ThePoint );
  1263.     TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1264.     exit;
  1265.   end;
  1266. end;
  1267.  
  1268. procedure TCCFileMgrForm.BitBtn9MouseMove(Sender: TObject;
  1269.   Shift: TShiftState; X, Y: Integer);
  1270. var ThePoint, TheOtherPoint : TPoint;
  1271. begin
  1272.   if IconDragging then
  1273.   begin
  1274.     ThePoint.X := X + Panel2.Left + BitBtn9.Left;
  1275.     ThePoint.Y := Y + Panel2.Top + BitBtn9.Top;
  1276.     TheOtherPoint := ClientToScreen( ThePoint );
  1277.     TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1278.     exit;
  1279.   end;
  1280.   if BitmapDragging then
  1281.   begin
  1282.     ThePoint.X := X + Panel2.Left + BitBtn9.Left;
  1283.     ThePoint.Y := Y + Panel2.Top + BitBtn9.Top;
  1284.     TheOtherPoint := ClientToScreen( ThePoint );
  1285.     TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1286.     exit;
  1287.   end;
  1288. end;
  1289.  
  1290. procedure TCCFileMgrForm.BitBtn6MouseMove(Sender: TObject;
  1291.   Shift: TShiftState; X, Y: Integer);
  1292. var ThePoint, TheOtherPoint : TPoint;
  1293. begin
  1294.   if IconDragging then
  1295.   begin
  1296.     ThePoint.X := X + Panel2.Left + BitBtn6.Left;
  1297.     ThePoint.Y := Y + Panel2.Top + BitBtn6.Top;
  1298.     TheOtherPoint := ClientToScreen( ThePoint );
  1299.     TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1300.     exit;
  1301.   end;
  1302.   if BitmapDragging then
  1303.   begin
  1304.     ThePoint.X := X + Panel2.Left + BitBtn6.Left;
  1305.     ThePoint.Y := Y + Panel2.Top + BitBtn6.Top;
  1306.     TheOtherPoint := ClientToScreen( ThePoint );
  1307.     TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1308.     exit;
  1309.   end;
  1310. end;
  1311.  
  1312. procedure TCCFileMgrForm.BitBtn7MouseMove(Sender: TObject;
  1313.   Shift: TShiftState; X, Y: Integer);
  1314. var ThePoint, TheOtherPoint : TPoint;
  1315. begin
  1316.   if IconDragging then
  1317.   begin
  1318.     ThePoint.X := X + Panel2.Left + BitBtn7.Left;
  1319.     ThePoint.Y := Y + Panel2.Top + BitBtn7.Top;
  1320.     TheOtherPoint := ClientToScreen( ThePoint );
  1321.     TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1322.     exit;
  1323.   end;
  1324.   if BitmapDragging then
  1325.   begin
  1326.     ThePoint.X := X + Panel2.Left + BitBtn7.Left;
  1327.     ThePoint.Y := Y + Panel2.Top + BitBtn7.Top;
  1328.     TheOtherPoint := ClientToScreen( ThePoint );
  1329.     TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1330.     exit;
  1331.   end;
  1332. end;
  1333.  
  1334. procedure TCCFileMgrForm.BitBtn10MouseMove(Sender: TObject;
  1335.   Shift: TShiftState; X, Y: Integer);
  1336. var ThePoint, TheOtherPoint : TPoint;
  1337. begin
  1338.   if IconDragging then
  1339.   begin
  1340.     ThePoint.X := X + Panel2.Left + BitBtn10.Left;
  1341.     ThePoint.Y := Y + Panel2.Top + BitBtn10.Top;
  1342.     TheOtherPoint := ClientToScreen( ThePoint );
  1343.     TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1344.     exit;
  1345.   end;
  1346.   if BitmapDragging then
  1347.   begin
  1348.     ThePoint.X := X + Panel2.Left + BitBtn10.Left;
  1349.     ThePoint.Y := Y + Panel2.Top + BitBtn10.Top;
  1350.     TheOtherPoint := ClientToScreen( ThePoint );
  1351.     TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1352.     exit;
  1353.   end;
  1354. end;
  1355.  
  1356. procedure TCCFileMgrForm.Panel5MouseMove(Sender: TObject;
  1357.   Shift: TShiftState; X, Y: Integer);
  1358. var ThePoint, TheOtherPoint : TPoint;
  1359. begin
  1360.   if IconDragging then
  1361.   begin
  1362.     ThePoint.X := X + Panel4.Left + Panel5.Left;
  1363.     ThePoint.Y := Y + Panel4.Top + Panel5.Top;
  1364.     TheOtherPoint := ClientToScreen( ThePoint );
  1365.     TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1366.     exit;
  1367.   end;
  1368.   if BitmapDragging then
  1369.   begin
  1370.     ThePoint.X := X + Panel4.Left + Panel5.Left;
  1371.     ThePoint.Y := Y + Panel4.Top + Panel5.Top;
  1372.     TheOtherPoint := ClientToScreen( ThePoint );
  1373.     TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1374.     exit;
  1375.   end;
  1376. end;
  1377.  
  1378. procedure TCCFileMgrForm.Panel6MouseMove(Sender: TObject;
  1379.   Shift: TShiftState; X, Y: Integer);
  1380. var ThePoint, TheOtherPoint : TPoint;
  1381. begin
  1382.   if IconDragging then
  1383.   begin
  1384.     ThePoint.X := X + Panel4.Left + Panel6.Left;
  1385.     ThePoint.Y := Y + Panel4.Top + Panel6.Top;
  1386.     TheOtherPoint := ClientToScreen( ThePoint );
  1387.     TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1388.     exit;
  1389.   end;
  1390.   if BitmapDragging then
  1391.   begin
  1392.     ThePoint.X := X + Panel4.Left + Panel6.Left;
  1393.     ThePoint.Y := Y + Panel4.Top + Panel6.Top;
  1394.     TheOtherPoint := ClientToScreen( ThePoint );
  1395.     TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1396.     exit;
  1397.   end;
  1398. end;
  1399.  
  1400. procedure TCCFileMgrForm.Panel7MouseMove(Sender: TObject;
  1401.   Shift: TShiftState; X, Y: Integer);
  1402. var ThePoint, TheOtherPoint : TPoint;
  1403. begin
  1404.   if IconDragging then
  1405.   begin
  1406.     ThePoint.X := X + Panel4.Left + Panel7.Left;
  1407.     ThePoint.Y := Y + Panel4.Top + Panel7.Top;
  1408.     TheOtherPoint := ClientToScreen( ThePoint );
  1409.     TheMouseManager.MoveIconCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1410.     exit;
  1411.   end;
  1412.   if BitmapDragging then
  1413.   begin
  1414.     ThePoint.X := X + Panel4.Left + Panel7.Left;
  1415.     ThePoint.Y := Y + Panel4.Top + Panel7.Top;
  1416.     TheOtherPoint := ClientToScreen( ThePoint );
  1417.     TheMouseManager.MoveBitmapCursor( TheOtherPoint.X , TheOtherPoint.Y );
  1418.     exit;
  1419.   end;
  1420. end;
  1421.  
  1422. procedure TCCFileMgrForm.Panel1MouseUp(Sender: TObject;
  1423.   Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
  1424. begin
  1425.   if ( IconDragging or BitmapDragging ) then
  1426.   begin
  1427.     if IconDragging then TheMouseManager.EndIconCursor( X , Y );
  1428.     if BitmapDragging then TheMouseManager.EndBitmapCursor( X , Y );
  1429.     IconDragging := false;
  1430.     BitmapDragging := false;
  1431.     Invalidate;
  1432.   end;
  1433. end;
  1434.  
  1435. procedure TCCFileMgrForm.BitBtn1MouseUp(Sender: TObject;
  1436.   Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
  1437. var CurrentName ,                 { Holds work name}
  1438.     WorkingDir ,
  1439.     TheOldString : String;        { Holds Dir      }
  1440.     TargetDir    : String;        { target of op   }
  1441.     TheResult    : Integer;       { Modal res hold }
  1442.     Counter_1    : Integer;
  1443. begin
  1444.   If ( IconDragging  or BitmapDragging )then
  1445.   begin
  1446.     if IconDragging then TheMouseManager.EndIconCursor( X , Y );
  1447.     if BitmapDragging then TheMouseManager.EndBitmapCursor( X , Y );
  1448.     IconDragging := false;
  1449.     BitmapDragging := false;
  1450.     with GlobalSource as TFileIconPanel do
  1451.     begin
  1452.       { Get current directory and save it for later }
  1453.       GetDir( 0 , TheOldString );
  1454.       { Display the Windows-based directory input form }
  1455.       TheResult := DestDDForm.ShowModal;
  1456.       { If not cancelled do the copy }
  1457.       if TheResult = mrOK then
  1458.       begin
  1459.         CurrentName := FTheName;
  1460.         { Get the target directory with \ OK }
  1461.         TargetDir := DestDDForm.GetTargetDirectory;
  1462.         { If a directory signal and do recursive operation }
  1463.         if (( FileGetAttr( CurrentName ) and faDirectory ) = faDirectory ) then
  1464.         begin
  1465.           if MessageDlg( 'Copy Directory ' + CurrentName + ' to ' + TargetDir
  1466.            +'?', mtConfirmation , mbYesNoCancel , 0 ) = mryes then
  1467.           begin
  1468.             ScrollBox1.TheFWB.RecursivelyCopyDirectory( CurrentName ,
  1469.              TargetDir );
  1470.           end;
  1471.         end
  1472.         else
  1473.         begin
  1474.           { Do the copy }
  1475.           Scrollbox1.TheFWB.CopyTheFile( CurrentName , TargetDir );
  1476.         end;
  1477.         { Reset to the original directory }
  1478.         ChDir( TheOldString );
  1479.       end
  1480.       else Invalidate;
  1481.     end;
  1482.   end;
  1483. end;
  1484.  
  1485. procedure TCCFileMgrForm.BitBtn2MouseUp(Sender: TObject;
  1486.   Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
  1487. var CurrentName ,                 { Holds work name}
  1488.     WorkingDir ,
  1489.     TheOldString : String;        { Holds Dir      }
  1490.     TargetDir    : String;        { target of op   }
  1491.     TheResult       : Integer;    { Modal res hold }
  1492.     Counter_1   : Integer;
  1493. begin
  1494.   If ( IconDragging  or BitmapDragging )then
  1495.   begin
  1496.     if IconDragging then TheMouseManager.EndIconCursor( X , Y );
  1497.     if BitmapDragging then TheMouseManager.EndBitmapCursor( X , Y );
  1498.     IconDragging := false;
  1499.     BitmapDragging := false;
  1500.     with GlobalSource as TFileIconPanel do
  1501.     begin
  1502.       { Get current directory and save it for later }
  1503.       GetDir( 0 , TheOldString );
  1504.       { Display the Windows-based directory input form }
  1505.       TheResult := DestDDForm.ShowModal;
  1506.       { If not cancelled do the copy }
  1507.       if TheResult = mrOK then
  1508.       begin
  1509.         { Get the target directory with \ OK }
  1510.         TargetDir := DestDDForm.GetTargetDirectory;
  1511.         { If Copyfile returns false an error occurred }
  1512.         CurrentName := FTheName;
  1513.         { If a directory signal and do recursion }
  1514.         if (( FileGetAttr( CurrentName ) and faDirectory ) = faDirectory ) then
  1515.         begin
  1516.           if MessageDlg( 'Move Directory ' + CurrentName + ' to ' + TargetDir +
  1517.            '?' , mtConfirmation , mbYesNoCancel , 0 ) = mrYes then
  1518.             ScrollBox1.TheFWB.RecursivelyMoveDirectory( CurrentName ,
  1519.              TargetDir );
  1520.         end
  1521.         else
  1522.         begin  { Do the move }
  1523.           Scrollbox1.TheFWB.MoveTheFile( CurrentName , TargetDir );
  1524.           ChDir( TheOldString );
  1525.         end;
  1526.         { Refresh display }
  1527.         ScrollBox1.Update;
  1528.       end
  1529.       else Invalidate;
  1530.     end;
  1531.   end;
  1532. end;
  1533.  
  1534. procedure TCCFileMgrForm.BitBtn3MouseUp(Sender: TObject;
  1535.   Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
  1536. var WorkingDir ,
  1537.     CurrentName : String;  { Holds work name}
  1538.     Counter_1   : Integer;
  1539. begin
  1540.   If ( IconDragging  or BitmapDragging )then
  1541.   begin
  1542.     if IconDragging then TheMouseManager.EndIconCursor( X , Y );
  1543.     if BitmapDragging then TheMouseManager.EndBitmapCursor( X , Y );
  1544.     IconDragging := false;
  1545.     BitmapDragging := false;
  1546.     with GLobalSource as TFileIconPanel do
  1547.     begin
  1548.       CurrentName := FTheName;
  1549.       { If its a directory signal and do recursive delete }
  1550.       if (( FileGetAttr( CurrentName ) and faDirectory ) = faDirectory ) then
  1551.       begin
  1552.         if MessageDlg( 'Delete Directory ' + CurrentName + '?' , mtConfirmation ,
  1553.          mbYesNoCancel , 0 ) = mrYes then
  1554.         begin
  1555.           Scrollbox1.TheFWB.RecursivelyDeleteDirectory( CurrentName );
  1556.           Scrollbox1.TheFWB.RemoveDirectory( CurrentName );
  1557.         end
  1558.         else Invalidate;
  1559.       end
  1560.       else
  1561.       begin
  1562.         { Otherwise get confirmation message and if OKed delete file }
  1563.         if MessageDlg( 'Delete file ' + CurrentName + '?', mtConfirmation ,
  1564.          mbYesNoCancel , 0 ) = mrYes then
  1565.         begin
  1566.           Scrollbox1.TheFWB.DeleteTheFile( CurrentName );
  1567.         end
  1568.         else Invalidate;
  1569.       end;
  1570.       { Refresh Display }
  1571.       Scrollbox1.Update;
  1572.     end;
  1573.   end;
  1574. end;
  1575.  
  1576. procedure TCCFileMgrForm.BitBtn4MouseUp(Sender: TObject;
  1577.   Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
  1578. var WorkingDir ,
  1579.     CurrentName : String;  { Holds work name}
  1580.     Counter_1   : Integer;
  1581. begin
  1582.   If ( IconDragging  or BitmapDragging )then
  1583.   begin
  1584.     if IconDragging then TheMouseManager.EndIconCursor( X , Y );
  1585.     if BitmapDragging then TheMouseManager.EndBitmapCursor( X , Y );
  1586.     IconDragging := false;
  1587.     BitmapDragging := false;
  1588.     with GlobalSource as TFileIconPanel do
  1589.     begin
  1590.       CurrentName := FTheName;
  1591.       { If a directory signal error }
  1592.       { Otherwise set up the opendialog with filename and caption }
  1593.       OpenDialog2.Filename := ExtractFilename( CurrentName );
  1594.       { Use this to prevent error from changing directories }
  1595.       OpenDialog2.Options := [ofNoChangeDir];
  1596.       OpenDialog2.Title := 'Rename File';
  1597.       { If not cancelled then do rename or signal error }
  1598.       if OpenDialog2.Execute then
  1599.       begin
  1600.         Scrollbox1.TheFWB.RenameTheFile( CurrentName , OpenDialog2.Filename );
  1601.       end
  1602.       else Invalidate;
  1603.       { Refresh the display }
  1604.       ScrollBox1.Update;
  1605.     end;
  1606.   end;
  1607. end;
  1608.  
  1609. end.
  1610.